<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增商品')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goods-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品名称：</label>
                <div class="col-sm-8">
                    <input name="name" class="col-sm-3 control-label is-required" type="text" maxlength="10" required>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>商品名称最多10字</span>

                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品价格：</label>
                <div class="col-sm-8">
                    <input name="price" class="form-control" type="number" id ="price" maxlength="6" required>
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商品描述：</label>
                <div class="col-sm-8">
                    <textarea name="describe" class="form-control" maxlength="100" required></textarea>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>商品描述最多100字</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品上下架状态：</label>
                <div class="col-sm-8">
                    <!--<select name="status" class="form-control m-b">
                        <option value="1">上架</option>
                        <option value="0">未上架</option>
                    </select>-->
                    <select name="status" class="form-control m-b" th:with="type=${@dict.getType('sys_goods_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label"></label>
                <div class="col-sm-8">
                    <input name="creator" class="form-control" type="hidden">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/goods"
        $("#form-goods-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-goods-add').serialize());
            }
        }

        $("input[name='time']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>
</body>
</html>